<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								试题类型：<input type="text" name="type"/>
							</li>

							<li>
								试题内容：<input type="text" name="question"/>
							</li>

							<li>
								限时：<input type="text" name="timeLimit"/>
							</li>

							<li>
								试题状态：<input type="text" name="status"/>
							</li>

							<li>
								题目解析：<input type="text" name="analyze"/>
							</li>

							<li>
								难度：<input type="text" name="level"/>
							</li>

							<li>
								创建时间：<input type="text" name="createTime"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:examQuestion:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:examQuestion:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-info" onclick="$.table.importExcelT()" shiro:hasPermission="system:examQuestion:import">
					<i class="fa fa-upload"></i> 导入
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:examQuestion:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:examQuestion:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:examQuestion:remove')}]];
        var prefix = ctx + "system/examQuestion";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "试题",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '主键id',
					visible: false
				},
				{
					field : 'type', 
					title : '试题类型',
                    formatter: function (value, row, index) {
					    if(row.type==1){
					        return "试题类型一";
						}else {
					        return "试题类型二";
						}
                    }
				},
				{
					field : 'question', 
					title : '试题内容',
					sortable: true
				},
				{
					field : 'timeLimit', 
					title : '限时',
					sortable: true
				},
				{
					field : 'status', 
					title : '试题状态',
					sortable: true,
                    formatter: function (value, row, index) {
                        if(row.status==0){
                            return "可用";
                        }else{
                            return "不可用";
                        }
                    }
				},
				{
					field : 'analyze', 
					title : '题目解析',
					sortable: true
				},
				{
					field : 'level', 
					title : '难度',
					sortable: true,
                    formatter: function (value, row, index) {
                        if(row.level==0){
                            return "初级";
                        }else if(row.level==1){
                            return "中级";
                        }else {
                            return "高级";
						}
                    }
				},
				{
					field : 'createTime', 
					title : '创建时间',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
	 <form id="importForm" enctype="multipart/form-data" class="mt20 mb10" style="display: none;">
		 <div class="col-xs-offset-1">
			 <input type="file" id="file" name="file"/>

		 </div>
	 </form>
</body>
</html>